<!DOCTYPE html>
<html>
<head>
    {include file='public/meta'/}

</head>
<body>
{include file='public/header'/}
<!------------------导航-------------------------->
<section>
    {include file='public/left'/}
    <!--------------------------主要内容区域------------------------------------->
    <div class="content">

        <div class="panel mgl15 mgr15">
            <div class="panel-body">
                <!--路径导航-->
                <ol class="breadcrumb">
                    <li>当前位置是:</li>
                    <li>
                        <a href="{:url('cardus/cardinfo',['card_id'=>$card['card_id']])}">会员卡管理</a>
                    </li>
                    <li class="active">支付即会员</li>
                </ol>
                <div>
                    <div>
                        <div class="panel panel-default ng-scope">
                            <div class="panel-heading">
                                支付即会员规则列表
                            </div>
                            <div class="panel-body">
                                <table class="table table-bordered">
                                    <thead>
                                    <tr>
                                        <td>编号</td>
                                        <td>商户号</td>
                                        <td>开始时间</td>
                                        <td>结束时间</td>
                                        <td>最小金额</td>
                                        <td>最大金额</td>
                                        <td>创建时间</td>
                                        <td class="text-center">操作</td>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    {volist name="rutlist" id="vo"}
                                    <tr ng-if="!instances.list.length" class="ng-scope">
                                        <td>{$vo.id}</td>
                                        <td>{$vo.sub_mach_id}</td>
                                        <td>{$vo.begin_time|date="Y-m-d H:i",###}</td>
                                        <td>{$vo.end_time|date="Y-m-d H:i",###}</td>
                                        <td>{$vo.least_cost}</td>
                                        <td>{$vo.max_cost}</td>
                                        <td>{$vo.creattime|date="Y-m-d H:i:s",###}</td>
                                        <td><a class="btn-link" href="{:url('marke/payputdel',['id'=>$vo['id'],'card_id'=>$card['card_id'],'rule_id'=>$vo['rule_id']])}">删除</a></td>
                                    </tr>
                                    {/volist}
                                    </tbody>
                                </table>
                            </div>
                        </div>

                        <div class="panel panel-default ng-scope">
                            {eq name="card.pay_type" value="2"}
                            <form action="" method="post" onsubmit="return check()">
                                <div class="panel-heading">
                                    新增支付即会员规则
                                </div>
                                <div class="panel-body">
                                    <div class="row">
                                        <div class="col-sm-6">
                                            <div class="form-horizontal" data-label="商户号">
                                                <div class="form-group">
                                                    <label class="col-sm-2 control-label">商户号</label>
                                                    <div class="col-sm-10">
                                                    <textarea class="form-control" style="resize: none;" rows="4"
                                                              name="mchid_list" autocomplete="off" placeholder=""
                                                              required="required"></textarea>
                                                        <div class="r-message text-danger"></div>
                                                        <div class="r-desc ">支持赠券规则的商户号列表。注意：请用小写 , 号分割。
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="col-sm-6">
                                            <div class="form-horizontal" data-label="开始时间"
                                                 data-layout="horizontal">
                                                <div class="form-group">
                                                    <label class="col-sm-2 control-label">选择时间</label>
                                                    <div class="col-sm-10">
                                                        <input type="text" name="times" class="form-control" value="" placeholder="请选择开始时间-结束时间" readonly="readonly" id="starttime">
                                                        <div class="r-message text-danger"></div>
                                                    </div>
                                                </div>
                                            </div>


                                            <div class="form-horizontal" data-layout="horizontal">
                                                <div class="form-group">
                                                    <label class="col-sm-2 control-label">最小金额</label>
                                                    <div class="col-sm-10">
                                                        <input type="text" class="form-control" autocomplete="off"
                                                               placeholder="" name="lcost" id="lcost" required="required">
                                                        <div class="r-message text-danger"></div>
                                                        <div class="r-desc ">
                                                            本次规则生效支付金额下限，开启时须填写。（单位：元）
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="form-horizontal">
                                                <div class="form-group">
                                                    <label class="col-sm-2 control-label ng-binding">最大金额</label>
                                                    <div class="col-sm-10">
                                                        <input type="text" class="form-control" autocomplete="off"
                                                               placeholder="" name="mcost" id="mcost" required="required">
                                                        <div class="r-message text-danger"></div>
                                                        <div class="r-desc">
                                                            本次规则生效支付金额上限，开启时须填写。（单位：元）
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="alert alert-danger"
                                         style="margin:0;">最小金额不能为空
                                    </div>
                                </div>
                                <div class="panel-footer">
                                    <button class="btn btn-success" type="submit">保存</button>
                                </div>
                            </form>
                            {else/}
                            <div class="alert alert-danger" role="alert">
                                暂时只可存在一条支付后赠券规则。
                            </div>
                            {/eq}
                        </div>

                        <div class="panel panel-default ng-scope">
                            <div class="panel-heading">
                                功能说明
                            </div>
                            <div class="panel-body">
                                <p>
                                    <small>用户在微信支付后自动为用户发送一条领卡消息，用户点击消息即可领取会员卡。</small>
                                </p>
                                <div class="row">
                                    <div class="col-lg-6">
                                        <img class="img-responsive" src="__STATIC_URL__/static/images/0.jpg">
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        {include file='public/footer'/}
    </div>
</section>
<script src="__STATIC_URL__/static/laydate/laydate.js"></script>
<script>

    laydate.render({
        elem: '#starttime',
        type: 'datetime',
        range:'-',

        change: function(value, date,endDate){ //监听日期被切换


        }
    });



</script>
<script>
    function check(){

        var starttime=$("#starttime").val();
        var lcost=parseFloat($("#lcost").val())
        var mcost=parseFloat($("#mcost").val())

        if(starttime==""){
            alert('请选择时间！');
            return false;
        }

        if(lcost==""||lcost<0.01){
            alert('请填写最小金额且不能小于0.01！');
            return false;
        }
        if(mcost==""){
            alert('请填写最大金额！');
            return false;
        }
        // 校验通过，全部都不相同
        return true;

    }
</script>
</body>

</html>
